
<template>
	<div class="padding-container preview-wrap" v-loading.fullscreen.lock="fullscreenLoading">
    <div class="title-part">
		</div>
		<div class="data-preview">
	    <el-form class="tab-pan form-inline" size="small" label-position="right" :label-width="formLabelWidth">
        <el-form-item :label="getLabel('appName')">
          <span>{{ baseData.appName | dataFormat }}</span>
        </el-form-item>
        <el-form-item :label="getLabel('appVersion')">
          <span>{{ baseData.appVersion | dataFormat }}</span>
        </el-form-item>
        <el-form-item :label="getLabel('deviceType')">
          <span>{{ baseData.typeName | dataFormat }}</span>
        </el-form-item>
        <el-form-item :label="getLabel('isPublic')">
          <span>{{ baseState.isPublic, baseData.isPublic, "--" | matchValue }}</span>
        </el-form-item>
        <el-form-item :label="getLabel('auditState')">
          <span>{{ baseState.appAuditState, baseData.auditState, "--" | matchValue }}</span>
        </el-form-item>
        <el-form-item :label="getLabel('file')">
          <span>{{ baseData.appIdentification | dataFormat}}.jar</span>
          <span v-if="baseData.appUrl != null && baseData.appUrl.endsWith('.jar')"><a style="margin-left:15px;" class="download" :href="baseData.appUrl" target="_blank">{{ $root.lang.control.app.detail.download }}</a></span>
        </el-form-item>
        <el-form-item :label="getLabel('appDesc')">
          <span>{{ baseData.appDesc | dataFormat }}</span>
        </el-form-item>
      </el-form>
      <el-form class="tab-pan form-inline" size="small" label-position="right" :label-width="formLabelWidth">
        <el-form-item :label="getLabel('appIdentification')">
          <span>{{ baseData.appIdentification | dataFormat }}</span>
        </el-form-item>
        <el-form-item :label="getLabel('appMainClass')">
          <span>{{ baseData.appMainClass | dataFormat }}</span>
        </el-form-item>
        <el-form-item :label="getLabel('appSupplier')">
          <span>{{ baseData.appSupplier | dataFormat }}</span>
        </el-form-item>
        <el-form-item :label="getLabel('creUser')">
          <span v-if="baseData.isPublic == 0">{{ baseData.userName | dataFormat }}</span>
          <span v-else-if="baseData.isPublic == 1">{{ baseData.publicUserName | dataFormat }}</span>
        </el-form-item>
        <el-form-item :label="getLabel('creTime')">
          <span>{{ baseData.creTime | dateFormat }}</span>
        </el-form-item>
      </el-form>
		</div>
	</div>
</template>

<script>
import '@/options/baseState'
export default {
	name: 'PrivateDetail',
	data() {
		return {
			id: null,
			fullscreenLoading: true,
			baseData: {},
      editData:{},
      showEdit:false,
			formLabelWidth: '120px',
      baseState: {},
		}
	},
	methods: {
		getLabel(name) {
      return this.$root.lang.control.app.detail[name]+'：'
    },
    getReceive(data) {
      this[data.key] = data.value
    },
    reloadTable() {
      this.getDetail()
    },
    getDetail() {
      let tableParams = {
        id: this.id
      }
      this.fullscreenLoading = true
      this.request({
        url: '/application/private/page',
        method: 'post',
        data: this.$root.optionProcess(tableParams)
      }).then(response => {
        this.baseData = response.rows[0]
        this.fullscreenLoading = false
      }).catch(error => {
        this.appList = []
        this.fullscreenLoading = false
        this.$message({
          message: error.errmsg,
          type: 'error',
          duration: 3 * 1000
        })
      })
    },
    checkLang() {
      let langType = this.$root.getStorage('lang')
      if(langType == 'en') {
        this.baseState = enBaseState
      } else {
        this.baseState = baseState
      }
    },
	},
	created() {
		if(this.$root.langType == 'en'){
      this.formLabelWidth = '160px'
    }
    this.id = this.$route.params.id
    this.checkLang()
    this.getDetail()
	}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
	.padding-container {
		text-align: left;
		.title-part {
			text-align: left;
			padding-bottom:20px;
			font-size:18px;
		}
		.el-button {
			margin-left:40px;
		}
		.form-inline {
			display: inline-block;
			vertical-align: top;
			min-width:300px;
		}
		.el-form-item__label {
			width:130px !important;
		}
		.download {
			text-decoration: underline;
      cursor:pointer;
      color:#409EFF;
		}
	}
</style>